//
//  NSObject+JSON.m
//  SmartTalk
//
//  Created by 陈勃 on 14-12-25.
//  Copyright (c) 2014年 gameabc. All rights reserved.
//

#import "NSObject+JSON.h"

@implementation NSObject (jsonDefine)

- (NSString *)JSONRepresentation {
    NSError *error =  nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}

@end



@implementation NSString (NSString_SBJsonParsing)

- (id)JSONValue {
    NSError *error =  nil;
   return [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error];
}

@end
